< previous page page_720 next page >

Page 720
Table A.7 Scope Prefixes.
PrefixDescription
gGlobal or public
mModule- or form-level variable/object
stStatic variable

Local variables should not have a prefix. This will distinguish them as being local and not having a scope outside of the current procedure. Here are some examples of declaring variables:
9f31265bb40b592b1929e18a47ab28e5.gif
        Global gintLoop As Integer
        Dim mstrName As String
        Private pboolOpen As Boolean
Handles
When programming Windows using the Windows API, youre frequently dealing with handles to windows. Youll also find handles when dealing with the ODBC API. As such, you need a special prefix to identify handles. Use the prefix h to name a handle variable:
9f31265bb40b592b1929e18a47ab28e5.gif
Dim hWnd As Long      ' Handle to a Window
Dim hEnv As Long      ' Handle to the ODBC environment space
Dim hdbc As Long      ' Handle to an ODBC data connection
User-defined Types
Declare user-defined types with the prefix typ. Variables that are dimmed of this particular type should also be referenced with a typ prefix. This will help distinguish the setting of elements in a user-defined type from the setting of properties in an object. Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
Type typCustomer
   strName As String
   strState As String * 2
   lngID as Long
End Type

 
< previous page page_720 next page >

If you like this book, buy it!